import Vue from 'vue'

const vm = new Vue()
const isNewVersion = () => {
  const url = `//${window.location.host}/static/version.json`
  vm.$get(url).then(res => {
    const version = res.data.version
    const localVersion = localStorage.getItem('version')
    if (localVersion && localVersion != version) {
      //   if (confirm("系统检测到有新版本，是否更新？")) {
      localStorage.setItem('version', res.data.version)
      window.location.reload()

      //   }
    } else {
      localStorage.setItem('version', res.data.version)
    }
  })
}
export default {
  isNewVersion
}
